import { BoxGeometry, PlaneGeometry, RawShaderMaterial, Vector2, Vector3 } from 'three'
import { Projection } from '../Basic/Projection'
import { OneDimensional } from './common'

/** 用于占位的材质不渲染任何东西 */
export const MATERIALPLACEHOLDER = new RawShaderMaterial({
  vertexShader: `
  void main(){
    gl_Position=vec4(0.0,0.0,0.0,0.0);
  }
  `,
  fragmentShader: `
  void main(){
    discard;
  }
  `
})

/** 单位正方形 */
export const UNITSQUARE = new PlaneGeometry(1, 1)

/** 单位立方体 */
export const UNITBOX = new BoxGeometry(1, 1,1)

/** 视锥体张角弧度 */
export const FOV = 53.13010235415597

/** 墨卡托最大坐标值 */
export const MOCATORMAX = 20037508.34278924

/** 投影函数 */
export const PROJECTION=new Projection([120,30],20)

/** 墨卡托坐标归一化函数 */
export const XTO1=new OneDimensional([-MOCATORMAX-PROJECTION.offset.x,MOCATORMAX-PROJECTION.offset.x])
export const YTO1=new OneDimensional([MOCATORMAX-PROJECTION.offset.y,-MOCATORMAX-PROJECTION.offset.y])

/** 地形服务地址 */
// export const TERRIANHOST='http://172.10.11.144:6080/arcgis/services/qgdem/dem_qg/ImageServer/WMSServer'
export const TERRIANHOST=''

/** 二维零点 */
export const ZERO2=new Vector2()

/** 三维零点 */
export const ZERO3=new Vector3()